unit udlgYesNo;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, udlgCustomDlgForm, Vcl.Buttons, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Imaging.pngimage;

type
  TdlgYesNo = class(TdlgCustomDlgForm)
    Image_Info: TImage;
    lText: TStaticText;
    procedure btOkClick(Sender: TObject);
  private
  public
  end;

  function dlgShowQuestionDlg(Owner: TComponent; const Caption, Msg: string; IsError: boolean = False;
    Height: integer = 125): integer;
  function dlgYesNo(const Caption, Msg: string): boolean; // True - Yes


implementation

{$R *.dfm}

function dlgShowQuestionDlg(Owner: TComponent; const Caption, Msg: string; IsError: boolean; Height: integer): integer;
var
  frmYesNo: TdlgYesNo;
begin
  frmYesNo:= TdlgYesNo.Create(Owner);
  frmYesNo.Caption:= Caption;
  frmYesNo.lCaption.Caption:= Caption;
  frmYesNo.lText.Caption:= Msg;
  frmYesNo.Height:= Height;
  frmYesNo.ShowModal;
  result:= frmYesNo.ButtonClicked;
  frmYesNo.Free;
end;

function dlgYesNo(const Caption, Msg: string): boolean;
begin
  result:= dlgShowQuestionDlg(nil, Caption, Msg) = IDYES;
end;

{ TfrmYesNo }

procedure TdlgYesNo.btOkClick(Sender: TObject);
begin
  FButtonClicked:= IDYES;
  Close;
end;

end.
